package com.lottery.im.module.tim.model;

import android.text.TextUtils;
import com.tencent.imsdk.ext.sns.TIMFriendFutureItem;
import com.tencent.imsdk.ext.sns.TIMFutureFriendType;

/**
 * 好友关系链消息的界面绑定数据
 * 可用于本地操作后界面修改
 */
public class FriendFuture {

  TIMFriendFutureItem futureItem;

  private TIMFutureFriendType type;

  private String faceUrl = "";

  public FriendFuture(TIMFriendFutureItem item) {
    futureItem = item;
    type = futureItem.getType();
  }

  public TIMFutureFriendType getType() {
    return type;
  }

  public void setType(TIMFutureFriendType type) {
    this.type = type;
  }

  public String getName() {
    return futureItem.getProfile().getNickName().equals("") ? futureItem.getIdentifier()
        : futureItem.getProfile().getNickName();
  }

  public String getMessage() {
    return futureItem.getAddWording();
  }

  public String getIdentify() {
    return futureItem.getIdentifier();
  }

  // 申请人  用户头像
  public String getFaceUrl() {
    FriendProfile profile = FriendshipInfo.getInstance().getProfile(futureItem.getIdentifier());
    if (null == profile || TextUtils.isEmpty(profile.getAvatarUrl())) {
      return futureItem.getProfile().getFaceUrl().equals("") ? faceUrl
          : futureItem.getProfile().getFaceUrl();
    }
    return profile.getAvatarUrl();
  }

  public void setFaceUrl(String faceUrl) {
    this.faceUrl = faceUrl;
  }
}
